//
//  XYBaseController.swift
//  WeiboSourceCode
//
//  Created by 周星宇 on 15/12/28.
//  Copyright © 2015年 cn.weibo. All rights reserved.
//

import UIKit

class XYBaseController: UITableViewController {
    
    
    let login = XYUserAccountViewModel.sharedUserAccountViewModel.userLogin

    override func viewDidLoad() {
        super.viewDidLoad()

    }
    override func loadView() {
        
        login == true ? super.loadView() : setUpBaseUI()
        
    }
    private func setUpBaseUI(){
        
        let newView = XYVisitorView()
        newView.registerBtn.addTarget(self, action: "regiserClick", forControlEvents: .TouchUpInside)
        
        newView.loginBtn.addTarget(self, action: "loginClick", forControlEvents: .TouchUpInside)
        view = newView
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", action: "regiserClick", target: self)
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", action: "loginClick", target: self)
    }
    @objc private func regiserClick(){
        
    }
    @objc private func loginClick(){

        let oauthVc = XYOAuthController()
        presentViewController(XYNavController(rootViewController:oauthVc), animated: true, completion: nil)
    }
    

}
